<?php
/**
 * 新闻分类
 */
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateArticleClassTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('article_class', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('pid')->default(0)->comment('父级ID');
            $table->string('path')->nullable()->comment('路径');
            $table->tinyInteger('level')->default(1)->comment('等级');
            $table->string('name')->nullable()->comment('活动名称');
            $table->integer('sort')->comment('排序');
            $table->timestamps();
            $table->softDeletes();
        });
        //添加表注释
        \Illuminate\Support\Facades\DB::statement("ALTER TABLE `".config('database.connections.mysql.prefix')."article_class` comment'新闻分类'");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('article_class');
    }
}
